package com.usian.user.controller;

import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.UserRelationDto;
import com.usian.model.user.pojos.ApUser;
import com.usian.user.ApUserControllerApi;
import com.usian.user.UserRelationControllerApi;
import com.usian.user.mapper.ApUserMapper;
import com.usian.user.service.UserRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/user")
public class UserRelationController implements UserRelationControllerApi, ApUserControllerApi {

    @Autowired
    private UserRelationService userRelationService;

    @Autowired
    private ApUserMapper apUserMapper;

    @Override
    @PostMapping("/user_follow")
    public ResponseResult follow(@RequestBody UserRelationDto dto) {
        return userRelationService.follow(dto);
    }

    @Override
    @GetMapping("/findUserById")
    public ApUser findUserById(@RequestParam Integer id) {
        return apUserMapper.selectById(id);
    }

}
